<template>
	<view class="content">
		<view class="top_area">
			<view class="user_info_area">
				<view class="user_img" @tap="goGeren()">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/user_img%402x.png" mode=""></image>
				</view>
				<view class="user_detail">
					<view class="nickname">新用户_POmuxxxx</view>
					<view class="vip">LV1 普通会员</view>
					<view class="inviteid">邀请码：2098767231321 <view>复制</view>
					</view>
				</view>
				<view class="signin_area" @tap="goQiandao()">
					签到
				</view>
			</view>
			<view class="income_area">
				<view class="income_box">
					<view class="income_box_item">
						<view class="income_box_item_num">
							{{numFilter(profitData.historyProfit)}}
						</view>
						<view class="income_box_item_name">
							总收益(元)
						</view>
					</view>
					<view class="income_box_item">
						<view class="income_box_item_num">
							{{numFilter(profitData.todayProfit)}}
						</view>
						<view class="income_box_item_name">
							今日收益
						</view>
					</view>
					<view class="income_box_item">
						<view class="income_box_item_num">
							{{numFilter(profitData.freezeProfit)}}
						</view>
						<view class="income_box_item_name">
							在途收益
						</view>
					</view>
				</view>
				<view class="income_do">
					<view @tap="goTixian()">提现</view>
					<view @tap="goMingxi()">明细</view>
				</view>
			</view>
		</view>

		<view class="myorder_area">
			<view class="myorder_top">
				<view class="myorder_tittle">
					我的订单
				</view>
				<view class="myorder_selectAll" @tap="goDingdan()">
					查看全部
				</view>
			</view>
			<view class="myorder_boxs">
				<view class="myorder_box_item">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/daifukuan%402x.png" mode=""></image>
					<view>待付款</view>
				</view>
				<view class="myorder_box_item">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/daifahuo%402x.png" mode=""></image>
					<view>待发货</view>
				</view>
				<view class="myorder_box_item">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/daipingjia%402x.png" mode=""></image>
					<view>待收货</view>
				</view>
				<view class="myorder_box_item">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/daishouhuo%402x.png" mode=""></image>
					<view>待评价</view>
				</view>
				<view class="myorder_box_item">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/shouhou%402x.png" mode=""></image>
					<view>退款/售后</view>
				</view>
			</view>
		</view>

		<view class="service_area">
			<view class="service_top">
				<view class="service_tittle">
					我的服务
				</view>
			</view>
			<view class="service_boxs">
				<view class="service_boxs_item" @tap="goUdian()">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/u_point%402x.png" mode=""></image>
					<view>我的u点</view>
				</view>
				<view class="service_boxs_item" @tap="goInvite()">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/yaoqing%402x.png" mode=""></image>
					<view>邀请有礼</view>
				</view>
				<view class="service_boxs_item" @tap="goQianbao()">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/wallete%402x.png" mode=""></image>
					<view>我的钱包</view>
				</view>
				<view class="service_boxs_item" @tap="goYouhui()">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/youhui%402x.png" mode=""></image>
					<view>优惠券</view>
				</view>
				<view class="service_boxs_item">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/kefu%402x.png" mode=""></image>
					<view>客户服务</view>
				</view>
				<view class="service_boxs_item">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/shoucang%402x.png" mode=""></image>
					<view>我的收藏</view>
				</view>
				<view class="service_boxs_item">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/dizhi%402x.png" mode=""></image>
					<view>收货地址</view>
				</view>
				<view class="service_boxs_item" @tap="goUs()">
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/dizhi%402x.png" mode=""></image>
					<view>关于我们</view>
				</view>
			</view>
			<view class="tel" @tap="kefuPhone()">
				<view class="tel_text">客服热线：</view>
				<view class="tel_num">4007899666</view>
			</view>
			<view class="online_time">在线时间：9:00-12:00 13:00-18:00</view>
		</view>
	</view>
</template>

<script>
	import http from 'common/http.js'
	export default {
		components: {},
		data() {
			return {
                profitData:[],
			}
		},
		onLoad() {
             this.getProfitData();
		},
		methods: {
			  numFilter (value) {//收益数计算
			    let realVal = ''
			    if (value) {
			      // 截取当前数据到小数点后两位
			      realVal = parseFloat(value)/100;
				  realVal = realVal.toFixed(2);
			    } else {
			      realVal = '0'
			    }
			    return realVal
			  },
			goQianbao() {
				uni.navigateTo({
					url: '../mine/mine-wallet/mine-wallet'
				})
			},
			goTixian() {
				uni.navigateTo({
					url: '../mine/mine-wallet-tixian/mine-wallet-tixian'
				})
			},
			goMingxi() {
				uni.navigateTo({
					url: '../mine/mine-shouyimingxi/mine-shouyimingxi?freezeProfit='+this.profitData.freezeProfit+'&historyProfit='+this.profitData.historyProfit+'&todayProfit='+this.profitData.todayProfit+'&cashMoney='+this.profitData.cashMoney+''
				})
			},
			goGeren() {
				uni.navigateTo({
					url: '../mine/mine-gerenzhongxin/mine-gerenzhongxin'
				})
			},
			goUdian() {
				uni.navigateTo({
					url: '../mine/mine-udian/mine-udian'
				})
			},
			goInvite() {
				uni.navigateTo({
					url: '../mine/mine-invite/mine-invite'
				})
			},
			kefuPhone() {
				uni.makePhoneCall({
					phoneNumber: '4007899666' //仅为示例
				})
			},
			goQiandao() {
				uni.navigateTo({
					url: '../mine/mine-udian-qiandao/mine-udian-qiandao'
				})
			},
			goUs() {
				uni.navigateTo({
					url: '../mine/mine-about/mine-about'
				})
			},
			goYouhui() {
				uni.navigateTo({
					 url:'../mine/mine-youhuiquan/mine-youhuiquan'
				})
			},
			goDingdan() {
				uni.navigateTo({
					url: '../goods/goods-orders/goods-orders'
				})
			},
			getProfitData(){
				var that=this;
				let opts={
	                        url: 'https://az49.ujquan.com/store/api/profit-sharing-server/v1/wallet?userId=302014',
	                        method: 'GET'
		                    };
		                 let param={};
		                 http.httpTokenRequest(opts, param).then(res => { //接口请求成功处理
						  this.profitData =res.data.data;
						   //console.log(res.data.data);
						  console.log(this.profitData);
		                        
		                 },error => {//接口请求失败
						console.log(error);
					})
			}
		},
		mounted(){
			this.getProfitData();
		},
	}
</script>

<style>
	page {
		background: rgba(245, 245, 245, 1);
	}

	.content {
		width: 100%;
		height: 100%;
		padding-bottom: 10px;
	}

	.top_area {
		width: 100%;
		height: 220px;
		background-image: url('http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/mine_back%402x.png');
		background-repeat: no-repeat;
		background-size: cover;
	}

	.user_info_area {
		padding-top: 50px;
		margin-left: 5%;
		width: 95%;
		height: 80px;
		display: flex;
	}

	.user_img {
		width: 50px;
		height: 80px;
	}

	.user_img image {
		width: 50px;
		height: 50px;
		border-radius: 20px;
	}

	.user_detail {
		width: 75%;
		height: 100%;
		padding-left: 10px;
	}

	.nickname {
		width: 100%;
		height: 26px;
		font-size: 16px;
		font-family: PingFangSC-Medium, PingFangSC;
		font-weight: 500;
		color: rgba(255, 255, 255, 1);
		line-height: 20px;
	}

	.vip {
		width: 100%;
		height: 26px;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		line-height: 15px;
	}

	.inviteid {
		width: 100%;
		height: 26px;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		line-height: 15px;
		display: flex;
	}

	.inviteid view {
		margin-left: 8px;
		width: 26px;
		height: 14px;
		font-size: 9px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		border: 1px solid #FFFFFF;
		line-height: 12px;
		text-align: center;
	}

	.signin_area {
		width: 45.5px;
		height: 25px;
		background: linear-gradient(90deg, rgba(255, 181, 36, 1) 0%, rgba(255, 116, 27, 1) 100%);
		border-radius: 100px 0px 0px 100px;
		font-size: 12px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		line-height: 25px;
		text-align: center;
		margin-top: 20px;
	}

	.income_area {
		width: 94.6%;
		height: 120px;
		margin: 0 auto;
		border-radius: 10px;
		box-shadow: 0px 8px 20px 0px rgba(153, 153, 153, 0.2);
		background-color: #FFFFFF;
	}

	.myorder_area {
		width: 94.6%;
		height: 120px;
		margin: 0 auto;
		margin-top: 40px;
		border-radius: 10px;
		box-shadow: 0px 8px 20px 0px rgba(153, 153, 153, 0.2);
		background-color: #FFFFFF;
	}

	.income_box {
		width: 100%;
		height: 70px;
		display: flex;
	}

	.income_box_item {
		width: 33.3%;
		height: 70px;
		text-align: center;
	}

	.income_box_item_num {
		width: 100%;
		height: 40px;
		font-size: 18px;
		font-family: PingFangSC-Medium, PingFangSC;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		line-height: 60px;
	}

	.income_box_item_name {
		width: 100%;
		height: 20px;
		font-size: 12px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		line-height: 20px;
		text-align: center;
	}

	.income_do {
		width: 94.6%;
		height: 40px;
		margin: 0 auto;
		border-top: 1px solid #E5E5E5;
		text-align: right;
	}

	.income_do view {
		margin-left: 8px;
		margin-top: 10px;
		width: 55px;
		height: 26px;
		text-align: center;
		line-height: 26px;
		border-radius: 26px;
		border: 1px solid rgba(254, 67, 56, 1);
		font-size: 14px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(254, 67, 56, 1);
		float: right;
	}

	.myorder_top {
		width: 100%;
		height: 28px;
		display: flex;
		padding-top: 20px;
	}

	.myorder_tittle {
		padding-left: 5%;
		width: 45%;
		font-size: 16px;
		font-family: PingFangSC-Medium, PingFangSC;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		line-height: 16px;
	}

	.myorder_selectAll {
		width: 45%;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		line-height: 15px;
		text-align: right;
	}

	.myorder_boxs {
		width: 100%;
		height: 73px;
		display: flex;
	}

	.myorder_box_item {
		width: 25%;
		height: 35px;
		text-align: center;
	}

	.myorder_box_item image {
		width: 35px;
		height: 35px;
	}

	.myorder_box_item view {
		width: 100%;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		line-height: 12px;
	}

	.service_area {
		width: 94.6%;
		height: 251.5px;
		margin: 0 auto;
		margin-top: 10px;
		border-radius: 10px;
		box-shadow: 0px 8px 20px 0px rgba(153, 153, 153, 0.2);
		background-color: #FFFFFF;
	}

	.service_top {
		width: 100%;
		height: 28px;
		display: flex;
		padding-top: 20px;
	}

	.service_tittle {
		padding-left: 5%;
		width: 45%;
		font-size: 16px;
		font-family: PingFangSC-Medium, PingFangSC;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		line-height: 16px;
	}

	.service_boxs {
		height: 138px;
		display: flex;
		flex-wrap: wrap;
		flex-direction: row;
	}

	.service_boxs_item {
		width: 25%;
		height: 64px;
		text-align: center;
	}

	.service_boxs_item image {
		width: 30px;
		height: 30px;
	}

	.service_boxs_item view {
		width: 100%;
		text-align: center;
		height: 22px;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		line-height: 22px;
	}

	.tel {
		width: 130px;
		height: 12px;
		margin: 0 auto;
		display: flex;
		margin-top: 10px;
	}

	.tel_text {
		width: 60px;
		font-size: 12px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		line-height: 12px;
		text-align: right;
	}

	.tel_num {
		width: 70px;
		font-size: 12px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: #3E86FF;
		line-height: 14px;
	}

	.online_time {
		margin-top: 10px;
		width: 100%;
		text-align: center;
		font-size: 10px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
		line-height: 10px;
	}
</style>
